package edu.upenn.seas.peerreview.smui
import edu.upenn.seas.peerreview.{Id, Source, Sink}

trait NameServerInterface extends RPCInterface {
  def get(key: String): Option[Id]        = default(key)
  def put(key: String, value: Id): Unit   = default(key, value)
}

trait BSManagerInterface extends RPCInterface { 
  // joins the server
  def joinServer: Unit = default()

  // returns a newgameconfigs for the next game, or none if tournament is over
  def getConfigs: Option[NewGameConfigs] = default()

  // announce player result after win or lose
  def sendPlayerResult(player: Id, h: Int, s: Int, d: Int, win: Boolean): Unit = default(player,h,s,d,win)

  // wait until the current game (not tournament) is over
  def waitGameOver: Unit = default()
}

//case class FireAt(target: Id, location: Point)
//case class NewGameConfigs(opponents:List[Id], boardSize:Point, ships:List[Int]) 

trait BSSMInterface extends RPCInterface {
  def linkUI: Unit = default()

  //tell everyone you've reached a certain spot in the code
  def synch(/*syncpoint: String*/): Unit = default()

  //return the place at which this player fired
  def getAttack: (Point, Id) = default()

  //return a list of (attacker, location, result) for each location at which this player was attacked
  def getFireResults: List[(Id, Point, FireResultType)] = default()

  //return a (hit, sink, defeat, isWinner) iff the player has been defeated
  def getPlayerResult: Option[(Int, Int, Int, Boolean)] = default()

  //announce player defeat/game end result
  def sendPlayerResult(h: Int, s: Int, d: Int, win: Boolean): Unit = default(h,s,d,win)

}

trait BSUIInterface extends RPCInterface {
  //initialize the ui with the given config settings (also, tell it who its sm is; the sender parameter is sent automatically
  def initialize(cfgs: NewGameConfigs): Unit = default(cfgs)
  def placeShips: Seq[(Point, Point)]        = default()
  def requestAction: (Id, Point)             = default()
  def sendFireResult(attacker: Id, target: Id, coord: Point, result: FireResultType): Unit =
    default(attacker, target, coord, result)
  def sendPlayerResult(player: Id, h: Int, s: Int, d: Int, win: Boolean): Unit =
    default(player, h, s, d, win)
  def gameOver: Unit                         = default()
  def tournamentOver: Unit                   = default()
}
